package cn.glinks.liuhe.api;

import cn.glinks.liuhe.baserx.BaseResponse;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
import rx.Observable;

/**
 * Des:ApiService
 *
 * @author MarsBlade of Cyh
 * @created 2017-03-13 18:29
 */
public interface ApiService {

    // 获取短信验证码(GET方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @GET("api/user/smscode")
    Observable<BaseResponse<String>> getSmscode(
            @Query("phoneNo") String phoneNo,
            @Query("action") int action);

    // 用户注册(POST方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @POST("api/user/register")
    Observable<BaseResponse<String>> postUserRegister(
            @Body RequestBody body);

    // 用户登录(POST方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @POST("api/user/login")
    Observable<BaseResponse<String>> postUserLogin(
            @Body RequestBody body);

    // 忘记密码(POST方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @POST("api/user/password/forget")
    Observable<BaseResponse<String>> postUserForgetPasswd(
            @Body RequestBody body);

    // 获取测试时间状态(GET方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @GET("api/user/test/time/state")
    Observable<BaseResponse<String>> getTestTimeStatus(
            @Header("Authorization") String auth,
            @Query("testTaskId") String testTaskId,
            @Query("beginTime") String beiginTime,
            @Query("endTime") String endTime);

    // 获取试题(GET方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @GET("api/user/test/question")
    Observable<BaseResponse<String>> getQuestions(
            @Header("Authorization") String auth,
            @Query("testTaskId") String testTaskId,
            @Query("beginTime") String beiginTime,
            @Query("endTime") String endTime);

    // 提交答案(POST方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @POST("api/user/test/question")
    Observable<BaseResponse<String>> postAnswers(
            @Header("Authorization") String auth,
            @Body RequestBody body);

    // 提交个人信息(POST方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @POST("api/user/personalInfo")
    Observable<BaseResponse<String>> postPersonalInfo(
            @Header("Authorization") String auth,
            @Body RequestBody body);

    // 提交爱好(POST方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @POST("api/user/personalInterest")
    Observable<BaseResponse<String>> postPersonalInterest(
            @Header("Authorization") String auth,
            @Body RequestBody body);

    // 获取测评历史记录(GET方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @GET("api/user/test/comment")
    Observable<BaseResponse<String>> getCommentHistory(
            @Header("Authorization") String auth);

    // 获取整体测评报告历史记录(GET方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @GET("api/user/test/group/comment")
    Observable<BaseResponse<String>> getGroupCommentHistory(
            @Header("Authorization") String auth);

    // 获取统计信息(GET方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @GET("api/user/test/statistics")
    Observable<BaseResponse<String>> getStatisticsData(
            @Header("Authorization") String auth);

    // 获取园区建议(GET方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @GET("api/user/test/parkAdvice")
    Observable<BaseResponse<String>> getParkAdvice(
            @Header("Authorization") String auth,
            @Query("parkCode") String parkCode);

    // 获取搜索结果(GET方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @GET("api/user/test/search/name")
    Observable<BaseResponse<String>> getSearchName(
            @Header("Authorization") String auth,
            @Query("parkCode") String parkCode,
            @Query("name") String name);

    // 获取搜索的员工信息(GET方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @GET("api/user/test/search/comment")
    Observable<BaseResponse<String>> getSearchPersonInfo(
            @Header("Authorization") String auth,
            @Query("emid") String emid);

    // 获取公司列表(GET方法)
    @Headers({"Content-Type: application/json; charset=utf-8"})//需要添加头
    @GET("file/register/company.json")
    Observable<BaseResponse<String>> getCompanyList();

}

